<template lang="html">
    <div class="">
        <p>1 使用v-bind绑定的class和普通class共存</p>
        <span class="old" :class="bgyellow">v-bind</span>
        <hr>


        <p>2 对象的方式绑定</p>
        <span  :class="{bgred:true,color:false}">v-bind</span>
        <span  :class="{bgred:true,color:true}">v-bind</span>
        <hr>


        <p>3 数组的方式绑定</p>
        <span  :class="['bgred','color']">v-bind</span>
        <span :class="classArr">arr test</span>
        <hr>

        <p>4 混合使用</p>
        <span  :class="[{'bgred':hasError},'black']">v-bind</span>
    </div>
</template>

<script>
export default {
	data() {
		return {
			bgyellow: 'backgroundColorYellow',
			classArr: ['bggreen', 'white'],
			hasError: true
		}
	}
}
</script>

<style lang="css">
.bggreen{
    background-color: green;
}
.white{
    color:#fff;
}
.old{
    color:red;
}
.backgroundColorYellow{
    background-color:yellow
}
.bgred{
    background-color: red;
}
.color{
    color:#fff;
}
.black{
    color:#333;
}
</style>
